CREATE TABLE operationlogs (
    id NUMBER(19) PRIMARY KEY,
    username VARCHAR2(50) NOT NULL,
    operation VARCHAR2(100) NOT NULL,
    method VARCHAR2(255),
    params CLOB,
    result CLOB,
    elapsed_time NUMBER(19),
    create_time TIMESTAMP DEFAULT SYSTIMESTAMP,
    ip_address VARCHAR2(20),
    status varchar2(10) NOT NULL
);
-- 创建序列以实现自增主键
CREATE SEQUENCE operationlogs_seq START WITH 1 INCREMENT BY 1;

-- 创建触发器，在插入时自动为 id 赋值
CREATE OR REPLACE TRIGGER operationlogs_trigger
BEFORE INSERT ON operationlogs
FOR EACH ROW
BEGIN
    :NEW.id := operationlogs_seq.NEXTVAL;
END;

commit;